package com.cs.cssupplier.controller;

import com.cs.cssupplier.domain.CsSupplier;
import com.cs.cssupplier.domain.CsWinningResults;
import com.cs.cssupplier.mapper.CsSupplierMapper;
import com.cs.cssupplier.mapper.CsWinningResultsMapper;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.security.utils.SecurityUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author：lyj
 * @Package：com.cs.cssupplier.controller
 * @Project：RuoYi-Cloud-master
 * @name：CsWinningResultsController
 * @Date：2024/12/19 18:49
 * @Filename：CsWinningResultsController
 */
@RestController
@RequestMapping("/results")
public class CsWinningResultsController extends BaseController {
    @Resource
    private CsWinningResultsMapper csWinningResultsMapper;
    @GetMapping("/list")
    public TableDataInfo list(CsWinningResults results){
        Long userid = SecurityUtils.getLoginUser().getUserid();
        Long sId=csWinningResultsMapper.getSipplierByUserId(userid);
        results.setHid(Integer.parseInt(sId+""));
        startPage();
        List<CsWinningResults> list=csWinningResultsMapper.selectCsWinningResults(results);
        return getDataTable(list);
    }

    @GetMapping("/winning/{gs_id}")
    public AjaxResult getInfoByZrId(@PathVariable("gs_id") Long gs_id) {
        return AjaxResult.success(csWinningResultsMapper.selectCsWinningResultsByZrId(gs_id));
    }
}
